import loading from '../../components/common/loading'

const load = {}
var interval = null
load.install = function (Vue) {
  const LoadingC = Vue.extend(loading)
  const instance = new LoadingC()
  instance.$mount(document.createElement('div'))
  document.body.appendChild(instance.$el)
  Vue.prototype.$loadingshow = () => {
    if(interval)
    clearTimeout(interval)
    instance.visible = true
    interval = setTimeout(function () {
      instance.visible = false
    }, 1000 * 600)
  }
  Vue.prototype.$loadingshowjindu = (par) => {
    if(interval)
    clearTimeout(interval)
    instance.visible = true
    instance.jindu = par
    interval = setTimeout(function () {

      instance.visible = false
    }, 1000 * 600)
  }
  Vue.prototype.$loadingclose = () => {
    clearTimeout(interval)
    instance.visible = false
  }
}
export default load
